package main

import "fmt"

type notifiler interface{
	notify() string
}

//结构体User
type User struct{
	name string
	email string
}

func (user *User) notify() string {  
	return fmt.Sprintf("send email to %s<%s> \n", user.name, user.email)
}

//结构体Admin
type Admin struct{
	name string
	email string
}

func (admin *Admin) notify() string { 
	return fmt.Sprintf("send email to %s<%s> \n", admin.name, admin.email)
}

func sendNotification(n notifiler){
	n.notify()
}

func main() {
	fmt.Println("vim-go")

	user1 := &User{
		name: "wang",
		email: "12345@qq.com",
	}

	admin1 := &Admin{
		name: "wlf",
		email: "12345@163.com",
	}

	sendNotification(user1)
	sendNotification(admin1)

}
